﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Google.Contacts;
using Google.Documents;
using DataType;
using MyGDocsAddIn;
using UILibrary;
using UnitTesting = Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestsRegression.Assert
{
    class LoginSuccess : State
    {
        public override void ValidateDataState(string UserName, string Password)
        {}

        public override void ValidateUIState()
        {
            MyGDocsForm form = m_Ui.GetUIAccessPoint();
            //check status message
            UnitTesting.Assert.AreEqual(form.StatusMessage.Visible, true);
            UnitTesting.Assert.AreEqual(form.StatusMessage.Text, "Succeeded: Login Successful");
            UnitTesting.Assert.AreEqual(form.StatusMessage.ForeColor, System.Drawing.Color.Black);

            //check all buttons state
            UnitTesting.Assert.AreEqual(form.UserName.Enabled, true);
            UnitTesting.Assert.AreEqual(form.Password.Enabled, true);
            UnitTesting.Assert.AreEqual(form.LoginButton.Visible, true);
            UnitTesting.Assert.AreEqual(form.LoginButton.Enabled, true);
            UnitTesting.Assert.AreEqual(form.ShareButton.Enabled, true);
            UnitTesting.Assert.AreEqual(form.UpdateBtn.Enabled, false);
        }
    }

    class LoginFailed : State
    {
        public override void ValidateDataState(string UserName, string Password)
        { }

        public override void ValidateUIState()
        {
            MyGDocsForm form = m_Ui.GetUIAccessPoint();
            //check status message
            UnitTesting.Assert.AreEqual(form.StatusMessage.Visible, true);
            UnitTesting.Assert.AreEqual(form.StatusMessage.ForeColor, System.Drawing.Color.Red);
            UnitTesting.Assert.AreNotEqual(form.StatusMessage.Text.Length, 0);

            //check all buttons state
            UnitTesting.Assert.AreEqual(form.UserName.Enabled, true);
            UnitTesting.Assert.AreEqual(form.Password.Enabled, true);
            UnitTesting.Assert.AreEqual(form.LoginButton.Visible, true);
            UnitTesting.Assert.AreEqual(form.LoginButton.Enabled, true);
            UnitTesting.Assert.AreEqual(form.ShareButton.Enabled, false);
            UnitTesting.Assert.AreEqual(form.UpdateBtn.Enabled, false);
        }
    }
}
